import { CellRenderer } from "../../../../../fl/controls/listClasses/CellRenderer";
import { AchievementMinorData } from "../data/AchievementMinorData";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { Language } from "../../../../../extend/language/Language";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
import { GButton } from "../../../../../com/mui/controls/GButton";
//class AchievementLatestCellRender
    
    export  class AchievementLatestCellRender extends CellRenderer
    {
        constructor()
        {
            super();
            this.initStyles();
            this.initView();
            this.mouseEnabled = false;
            this.mouseChildren = true;
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            this._myData = arg1 as AchievementMinorData;
            this._txtName.text = this._myData.name + "(" + this._myData.achievementLevel + ")";
            return;
        }

        /* internal  */initStyles(): void
        {
            this.setStyle("downSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("overSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("upSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedDownSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedOverSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedUpSkin", new Object /* flash.display.Bitmap */());
            return;
        }

        /* internal  */initView(): void
        {
            var loc1=null;
            this._txtName = ObjCreate.createGTextField("", -6, 13, 190, 22, this);
            loc1 = this._txtName.defaultTextFormat;
            loc1.size = 14;
            loc1.color = 65054;
            loc1.bold = true;
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this._txtName.defaultTextFormat = loc1;
            ObjCreate.createBg(1, 40, 180, 2, this, ImagesConst.SplitLine);
            this._btnAdd = ObjCreate.createGButton("", 158, 13, 18, 18, this, "AddBtn");
            this._btnAdd.addEventListener(flash.events.MouseEvent.CLICK, this.clickAddHandler);
            this._btnAdd.toolTipData = Language.getString(80109);
            return;
        }

        /* internal  */clickAddHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.AchievementClickShowMinorAchievemntGot, this._myData));
            return;
        }

        /* internal */ /* var */_txtName: GTextFiled;

        /* internal */ /* var */_txtDesc: GTextFiled;

        /* internal */ /* var */_myData: AchievementMinorData;

        /* internal */ /* var */_btnAdd: GButton;
    }
